//
//  ComplainTypeModel.swift
//  Pods
//
//  Created by eme on 2017/4/7.
//
//

import UIKit
import ModelProtocol
import SwiftyJSON

class ComplainTypeModel: ModelProtocol {
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kComplainTypeCategoriesKey: String = "categories"
    internal let kComplainTypeEnabledKey: String = "enabled"
    internal let kComplainTypeCompainTypeNameKey: String = "compainTypeName"
    internal let kComplainTypeTypecodeKey: String = "typecode"
    internal let kComplainTypeComplainTypeIdKey: String = "complainTypeId"
    internal let kComplainTypeRemarkKey: String = "remark"
    
    
    // MARK: 属性
    var categories: String
    var enabled: String
    var compainTypeName: String
    var typecode: String
    var complainTypeId: String
    var remark: String

    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        categories = json[kComplainTypeCategoriesKey].stringValue
        enabled = json[kComplainTypeEnabledKey].stringValue
        compainTypeName = json[kComplainTypeCompainTypeNameKey].stringValue
        typecode = json[kComplainTypeTypecodeKey].stringValue
        complainTypeId = json[kComplainTypeComplainTypeIdKey].stringValue
        remark = json[kComplainTypeRemarkKey].stringValue
        
    }    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        
        dictionary.updateValue(categories as AnyObject, forKey: kComplainTypeCategoriesKey)
    
        dictionary.updateValue(enabled as AnyObject, forKey: kComplainTypeEnabledKey)
    
        dictionary.updateValue(compainTypeName as AnyObject, forKey: kComplainTypeCompainTypeNameKey)
    
        dictionary.updateValue(typecode as AnyObject, forKey: kComplainTypeTypecodeKey)
    
        dictionary.updateValue(complainTypeId as AnyObject, forKey: kComplainTypeComplainTypeIdKey)
    
        dictionary.updateValue(remark as AnyObject, forKey: kComplainTypeRemarkKey)
        
        return dictionary
    }
    
    
}
